import React, { Component } from 'react';
import { StyleSheet, View } from 'react-native';

import { SafeAreaView } from 'react-navigation';
import BaseStyle from '../constants/Style';
import Btn from '../components/buttons';
import { ActionSheet, ActionDom } from '../components/actionsheet';

export default class RadioScreen extends Component {
  constructor(props) {
    super(props);
    this.state = {
      showAction: false,
      showAction2: false,
    };
  }

  render() {
    return (
      <SafeAreaView
        style={[BaseStyle.flex, styles.homebg]}
        forceInset={{ top: 'never' }}>
        <ActionSheet
          showAction={this.state.showAction}
          cancel={() => {
            this.setState({ showAction: false });
          }}>
          <ActionDom
            actionName={'我是按钮一'}
            onPress={() => {
              toast('你点击了按钮一');
            }}
          />
          <ActionDom
            actionName={'我是按钮二'}
            onPress={() => {
              alert('你点击了按钮二');
            }}
          />
        </ActionSheet>

        <ActionSheet
          title={'请选择条件'}
          showAction={this.state.showAction2}
          cancel={() => {
            this.setState({ showAction2: false });
          }}>
          <ActionDom
            actionName={'我是按钮一'}
            onPress={() => {
              toast('你点击了按钮一');
            }}
          />
          <ActionDom
            actionName={'我是按钮二'}
            onPress={() => {
              alert('你点击了按钮二');
            }}
          />
          <ActionDom
            actionName={'我是按钮三'}
            onPress={() => {
              alert('你点击了按钮三');
            }}
          />
        </ActionSheet>

        <View style={styles.container}>
          <Btn
            text={'action - sheet'}
            onPress={() => {
              this.setState({
                showAction: true,
              });
            }}
          />

          <Btn
            text={'带标题'}
            underlayColor={'#31bcfe'}
            btnStyle={{ marginTop: 30, backgroundColor: '#31bcfe' }}
            onPress={() => {
              this.setState({
                showAction2: true,
              });
            }}
          />
        </View>
      </SafeAreaView>
    );
  }
}

const styles = StyleSheet.create({
  homebg: {
    backgroundColor: '#eee',
  },
  container: {
    ...BaseStyle.flex,
    paddingTop: 20,
  },
});
